package com.google.guava.utilities;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.google.common.base.Stopwatch;

import java.util.concurrent.TimeUnit;

/**
 * @author fuc
 * @create 2020-08-22
 */
public class StopWatchExample {
  public static final Log log = LogFactory.get();

  public static void main(String[] args) throws InterruptedException {
    process("1234");
  }

  private static void process(String orderNo) throws InterruptedException {
    log.info("start process the oder [{}]", orderNo);
    Stopwatch stopwatch = Stopwatch.createStarted();
    TimeUnit.SECONDS.sleep(1);

    log.info("The order [{}] process successful and elapsed [{}]", orderNo, stopwatch.stop());
  }
}
